package com.ruoyi.zxjd.exposure.controller;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.zxjd.conference.domain.ConferenceArrange;
import com.ruoyi.zxjd.conference.domain.ConferenceProgress;
import com.ruoyi.zxjd.exposure.domain.ExposureArrange;
import com.ruoyi.zxjd.exposure.domain.ExposureProgress;
import com.ruoyi.zxjd.exposure.service.IExposureArrangeService;
import com.ruoyi.zxjd.exposure.service.IExposureProgressService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 曝光台Controller
 *
 * @author lcc
 * @date 2021-02-07
 */
@Controller
@RequestMapping("/exposure/exposure")
public class ExposureController {

    private String prefix = "exposure/exposure";

    @Autowired
    private IExposureProgressService exposureProgressService;

    @Autowired
    private IExposureArrangeService exposureArrangeService;

    @RequiresPermissions("exposure:exposure:view")
    @GetMapping()
    public String arrange()
    {
        return prefix + "/task_to_done";
    }

    /**
     * 个人中心参会人员详情
     */
    //@RequiresPermissions("work:progress:detail")
    @GetMapping("/detail/{progressId}")
    public String detail(@PathVariable("progressId") Long progressId, ModelMap mmap)
    {
        ExposureProgress exposureProgress = exposureProgressService.selectExposureProgressById(progressId);
        exposureProgress.setStatus("1");
        exposureProgress.setReceiveTime(DateUtils.getNowDate());
        exposureProgressService.updateExposureProgress(exposureProgress);
        ExposureArrange exposureArrange = exposureArrangeService.selectExposureArrangeById(exposureProgress.getArrangeId());
        mmap.put("exposureArrange",exposureArrange);
        return prefix + "/detail";
    }

}
